package com.ss.android.article.base.ui;

import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import com.ss.android.article.browser.R;

public class MessageTabLineView extends View {
    int a;
    private Context b;
    private Resources c;
    private int d;
    private int e;
    private int f;
    private Paint g;
    private Paint h;
    private int i;
    private int j;
    private int k;
    private float l;

    public MessageTabLineView(Context arg2) {
        this(arg2, null);
    }

    public MessageTabLineView(Context arg2, AttributeSet arg3) {
        this(arg2, arg3, 0);
    }

    public MessageTabLineView(Context arg6, AttributeSet arg7, int arg8) {
        super(arg6, arg7, arg8);
        this.a = 1;
        this.b = arg6;
        this.c = this.b.getResources();
        if(arg7 != null) {
            TypedArray v0 = this.b.obtainStyledAttributes(arg7, com.ss.android.article.base.a.M, arg8, 0);
            this.a = v0.getInt(com.ss.android.article.base.a.Q, 1);
            this.f = v0.getResourceId(com.ss.android.article.base.a.O, R.color.ar);
            this.e = v0.getResourceId(com.ss.android.article.base.a.N, R.color.transparent);
            this.d = v0.getDimensionPixelSize(com.ss.android.article.base.a.P, 0);
            v0.recycle();
        }

        this.g = new Paint(1);
        this.g.setColor(this.c.getColor(this.e));
        this.h = new Paint(1);
        this.h.setColor(this.c.getColor(this.f));
    }

    protected void onDraw(Canvas arg11) {
        int v6 = ((int)((((float)this.i)) * this.l));
        int v8 = v6 + this.k;
        int v9 = (v8 - v6 - this.d) / 2;
        arg11.drawRect(0f, 0f, ((float)(v6 + v9)), ((float)this.j), this.g);
        arg11.drawRect(((float)(v6 + v9)), 0f, ((float)(v8 - v9)), ((float)this.j), this.h);
        arg11.drawRect(((float)(v8 - v9)), 0f, ((float)this.i), ((float)this.j), this.g);
    }

    protected void onMeasure(int arg3, int arg4) {
        super.onMeasure(arg3, arg4);
        this.i = this.getWidth();
        this.j = this.getHeight();
        this.k = this.i / this.a;
    }

    public void setLocation(float arg3) {
        this.l = arg3;
        if(Thread.currentThread() == this.b.getMainLooper().getThread()) {
            this.invalidate();
        }
        else {
            this.postInvalidate();
        }
    }
}

